var translationCookie = 'dohmh_language_preference'; // This is the name of the cookie that is used.

function setLanguage(theLanguage){
	SetCookie(translationCookie,theLanguage); // TL
	SetCookie("googtrans","/en/"+theLanguage);
	hideTranslate();
	window.location.reload();
}

function showTranslate(){
	document.getElementById("shim").style.height=document.getElementById("translate_popup").offsetHeight;
	document.getElementById("shim").style.width=document.getElementById("translate_popup").offsetWidth;
	document.getElementById("translate_popup").style.top = 356;
	document.getElementById("translate_popup").style.visibility = "visible";
	document.getElementById("shim").style.top = document.getElementById("translate_popup").style.top;
	document.getElementById("shim").style.visibility = "visible";
}

function hideTranslate(){
	document.getElementById("translate_popup").style.visibility = "hidden";
	document.getElementById("shim").style.visibility = "hidden";
}


function resetLang() {
	hideTranslate();
	SetCookie(translationCookie,"");
	if(document.getElementById(":2.container")!=null){
		fireEvent(document.getElementById(":2.container").contentWindow.document.getElementById(":2.close"),"click");
	}
	window.location.reload();
}

function checkLanguage(){
	var theLang=GetCookie(translationCookie);
	if(theLang!=null&&theLang.length>0){
		if(theLang.toLowerCase()!="en"){
			document.getElementById("translate_button").innerHTML = '<a href="javascript:resetLang()" class="notranslate">Back to English</a>';
			if(navigator.appVersion.indexOf("MSIE") != -1){
				var theDivs=document.getElementsByTagName("div");
				for(var i=0;i<theDivs.length;i++){
					if(theDivs[i].className=="top_feature"){
						theDivs[i].style.top=235;
					}
				}
			}
		}
	}
}

addLoadEvent(checkLanguage);